package com.itheima.controller.backend.security.order;

import com.itheima.common.entity.Result;
import com.itheima.pojo.BusinessReportDataVO;
import com.itheima.pojo.MemberVO;
import com.itheima.pojo.SetmealVO;
import com.itheima.service.ReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

@RestController
@RequestMapping("/report")
public class ReportCpntroller {

    @Autowired
    private ReportService reportService;

    @GetMapping("/getSetmealReport")
    public Result getSetmealReport() {

        SetmealVO setmealVO = reportService.getSeymealReport();

        return new Result(true, "获取业务报表成功", setmealVO);
    }

    @GetMapping("getMemberReport")
    public Result getMemberReport(){

        MemberVO memberVO= reportService.getMemberReport();

        return new Result(true, "获取会员报表成功", memberVO);
    }

    @GetMapping("getBusinessReportData")
    public Result getBusinessReportData(){


        BusinessReportDataVO businessReportDataVO = reportService.getBusinessReportData();

        return new Result(true, "获取业务报表数据成功", businessReportDataVO);
    }

    @GetMapping("exportBusinessReport")
    public void exportBusinessReport(HttpServletResponse response) {

        reportService.exportBusinessReport(response);
//        return new Result(true, "导出业务报表成功");
    }




}
